]> dgit.raspbian.org Git - gnome-shell.git/commit
st: optimize box-shadow rendering
authorLionel Landwerlin <llandwerlin@gmail.com>
Wed, 3 Jul 2013 16:01:00 +0000 (17:01 +0100)
committerLionel Landwerlin <llandwerlin@gmail.com>
Tue, 9 Jul 2013 10:24:26 +0000 (11:24 +0100)
commit318283fc705bd9e97e511444303057feae71c587
treea517baf2bc43c2277ade3f43229c53a47b70d61a
parent3582ba0c7742d1ffbdfa4deff683f685d1fda6a6
st: optimize box-shadow rendering

Currently the box-shadow is rendering is done like this :

The first time we want to render a node that requires a box-shadow, St
creates an cogl offscreen surface of the size of the allocation and
renders the box into this offscreen buffer using modulation on the
alpha channel, this buffer is then blurred according to the CSS
parameters.

The problem with this method is that every time an StWidget is
resized, its box-shadow offscreen buffer has to be resized and
therefore rendered and blurred.

This patches propose an optimization for this use case by rendering
the box-shadow only once but at a size that is independent of the
StWidget's size. Then every time we need to paint this box-shadow, we
just render this offscreen buffer using a 9-slices.

This method only works when the allocation of the widget is bigger
than the minimum shadow size on which we can apply a 9-slices, that is
given my the radius of the corners. If the allocation is smaller than
this minimum size, we then fallback to the fully render/blur the
shadow (like before this patch).

https://bugzilla.gnome.org/show_bug.cgi?id=689858
src/st/st-theme-node-drawing.c
src/st/st-theme-node-private.h
src/st/st-theme-node.h